<div style="display: flex; position: relative; margin-top: 10px; align-items: center;">

    <span v-if="false" style="line-height: 30px;">共 @{{ filteredProjects.length }} 个项目</span>

    <div>
        <template v-if="queryParams.award_id == 1">
            <p style="margin-bottom:5px;">
                <label style="display: inline-block;width:120px;font-size: 14px">专业类别</label>
                <a-radio-group v-model="profCategoryFilter"
                               size="small">
                    <a-radio-button value="">不限(@{{ countProjectsByProfCategory('') }})</a-radio-button>
                    <a-radio-button v-for="category in profCategories"
                                    :value="category"
                                    :key="category">@{{ category }}(@{{ countProjectsByProfCategory(category) }})
                    </a-radio-button>
                </a-radio-group>
            </p>
        </template>

        @if($_GET['status_ids'] == 'B2')
        <template>
            <p>
                <label style="display: inline-block;width:120px;font-size: 14px">形式审查状态</label>
                <a-radio-group v-model="formalReviewStatusFilter"
                               size="small">
                    <a-radio-button value="">不限(@{{ countProjectsByFormalReviewStatus('')}})</a-radio-button>
                    <a-radio-button value="等待形式审查"
                                    key="等待形式审查">等待形式审查(@{{ countProjectsByFormalReviewStatus('等待形式审查') }})
                    </a-radio-button>
                    <a-radio-button value="通过形式审查"
                                    key="通过形式审查">通过形式审查(@{{ countProjectsByFormalReviewStatus('通过形式审查') }})
                    </a-radio-button>
                </a-radio-group>
            </p>
        </template>
        @endif

    </div>

    <span style="flex: 1;"></span>
    <a-input style="width: 300px;" placeholder="搜索" v-model="searchKeyword"/>
    <a-icon v-if="searchKeyword"
            style="position: absolute; top: 8px; right: 8px; color: #aaa; cursor: pointer;"
            type="cross"
            @click="searchKeyword = ''"/>

</div>

<a-table class="project-table"
         rowKey="id"
         size="small"
         :columns="projectTableColumns"
         :dataSource="filteredProjects"
         :loading="loadingPageData"
         :pagination="{pageSize: 10000, hideOnSinglePage: true, position: 'both', showTotal: total => `共 ${total} 项`}"
>
                                    <span slot="award_name" slot-scope="text, record">
                                        @{{ findAwardInfoById(record.award_id).name }}
                                    </span>
    <span slot="prof_category" slot-scope="text, record">

                                    <template v-if="record.status_id == 'B2'">
                                        <a-select style="width: 140px;" size="small" v-model="record.prof_category"
                                                  @change="handleProfCategoryChange(record, $event)">
                                            <a-select-option v-for="category in profCategories" :value="category"
                                                             :key="category">@{{ category }}</a-select-option>
                                        </a-select>
                                    </template>

                                    <template v-else>
                                        @{{ record.prof_category }}
                                    </template>

                                    </span>
    <span slot="project_name" slot-scope="text, record">
                                    @{{ record.project_name ? record.project_name : '-' }}
                                    <template v-if="record.status_id == 'A6' && record.group_name">
                                        <br>
                                        <a-tag color="orange">@{{ record.group_name }}</a-tag>
                                    </template>
                                    </span>
    <span slot="applicant" slot-scope="text, record">
                                        @{{ record.applicant_name }}
                                        <a-popover :title="record.applicant_name + '的联系方式'">
                                            <template slot="content">
                                                <table>
                                                    <tr>
                                                        <td width="30"><a-icon type="phone"/></td>
                                                        <td>@{{ record.applicant_tel }}</td>
                                                    </tr>
                                                    <tr>
                                                        <td><a-icon type="mail"/></td>
                                                        <td>@{{ record.applicant_email }}</td>
                                                    </tr>
                                                </table>
                                            </template>
                                            <a style="display: inline-block; font-size: 12px; min-width: 60px;" href="">联系方式</a>
                                        </a-popover>
                                        <br/>
                                        <span v-if="record.applicant_org_name">所在单位：@{{ record.applicant_org_name }}</span>
                                    </span>
    <span slot="application_form" slot-scope="text, record">
                                        <template v-if="record.award_id == 2">
                                            <a :href="'/home/view-form?id=' + record.id" target="_blank">
                                                <span>查看</span>
                                            </a>
                                        </template>
                                        <template v-else>
                                            <a :href="'/home/view-form?id=' + record.id" target="_blank">
                                                <span>查看</span>
                                            </a>
                                        </template>
                                    </span>
    <span slot="attachments" slot-scope="text, record">
                                            <a :href="'/home/view-attachments?project_id=' + record.id" target="_blank">
                                                <span>查看</span>
                                            </a>
                                    </span>
    <span slot="status" slot-scope="text, record">
                                        <span class="status-tag">@{{ record.status_info.status }}</span>
        <p v-if="record.status_id == 'B1.2'">退回原因: <br>@{{ record.status_remarks }}</p>
                                    </span>
    <span slot="todo" slot-scope="text, record">
                                        <span class="orange">@{{ record.status_info.admin_todo }}</span>
                                    </span>
    <span slot="operations" slot-scope="text, record">

                                        @php
                                           // 区别人物奖 进步奖 菜单权限
                                           // $Approved 通过形式审查
                                           // $Return   退回修改
                                           $award_id = $_GET['award_id'];
                                           if ($award_id == 1) {
                                                $Approved = isset($userMenusKeyData[7]) ? true : false;
                                                $Return   = isset($userMenusKeyData[8]) ? true : false;
                                           } else {
                                                $Approved = isset($userMenusKeyData[9]) ? true : false;
                                                $Return   = isset($userMenusKeyData[10]) ? true : false;
                                           }

                                        @endphp
                                        <template v-if="record.status_id == 'B2'">
                                            @if($Approved)
                                            <a-popconfirm title="确认通过形式审查？"
                                                          @confirm="projectFormalReviewPassed(record.id)" okText="是"
                                                          cancelText="否">
                                                <a-button type="primary" size="small">通过形式审查</a-button>
                                            </a-popconfirm>
                                            @endif

                                            @if($Return)
                                            <a-button style="margin-left: 8px;" size="small"
                                                      @click="showRecallReasonDialog(record)">退回修改</a-button>
                                            @endif
                                        </template>

                                        <!--atPhaseFormalReview 形式审查阶段开启状态-->
                                        <template v-if="record.status_id == 'C1' && atPhaseFormalReview">
                                            <a-popconfirm title="确认退回到形式审查？"
                                                          @confirm="updateProjectStatus(record, 'B2')" okText="是"
                                                          cancelText="否">
                                                <a-button style="margin-left: 8px;" size="small">退回到形式审查</a-button>
                                            </a-popconfirm>
                                        </template>

                                    </span>
</a-table>